package com.kexun.servlet.admin;

import com.alibaba.fastjson.JSON;
import com.kexun.pojo.Score;
import com.kexun.service.AdmService;
import com.kexun.service.impl.AdmServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Map;

@WebServlet("/ServletScoreLike")
public class ServletScoreLike extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        //设置编码
        request.setCharacterEncoding("UTF-8");
        response.setContentType("text/html;charset=UTF-8");

        System.out.println(11);
        String courseName = request.getParameter("courseName");
        String stuNum = request.getParameter("stuNum");
        String stuName = request.getParameter("stuName");
        String stuClass = request.getParameter("stuClass");
        String major = request.getParameter("major");
        String limitStr = request.getParameter("limit");
        String pageStr = request.getParameter("page");
        System.out.println(courseName);
        System.out.println(stuNum);
        System.out.println(stuName);
        System.out.println(stuClass);
        System.out.println(major);
        System.out.println(limitStr);
        System.out.println(pageStr);

        AdmService as = new AdmServiceImpl();
        Map<String,Object> map  = as.findScoreLike(courseName,stuNum,stuName,stuClass,major,limitStr,pageStr);
        String s = JSON.toJSONString(map);

        if(map!=null){
            response.getWriter().print(s);
        }


    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doPost(request, response);
    }
}
